package csel.view.status;

import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class ImageLoader
{

	public static JLabel makeLabel(String filename)
	{
		try
		{
			return new JLabel(new ImageIcon(ImageIO.read(new File("images/"+filename+".png"))));
		}
		catch (IOException exc)
		{
			System.out.println("ImageLoader.makeLabel() - image: "+filename+" not found!  Using text instead");
			return new JLabel(filename);
		}
	}
	
	public static ImageIcon makeIcon(String filename)
	{
		ImageIcon myIcon = null;
		try
		{
			myIcon = new ImageIcon(ImageIO.read(new File("images/"+filename+".png")));
		}
		catch (IOException e)
		{
			System.out.println("ImageLoader.makeIcon() - image: "+filename+" not found!");
		}
		return myIcon;
	}
	
}
